#include <stdio.h>
void Help(void);

//! Defines a single mapping from a string to a function.
typedef struct LCaseMapping
{
	char *String;
	void (*Function)(void);
} CaseMapping;

//! Defines a set of strings mapped to functions.
CaseMapping Mapping[] =
{
	{"help", Help},
};

/*!
  Tester entry point.
*/
int main(int argc, char *argv[])
{
	int i=0;
	int numMappings = sizeof(Mapping)/sizeof(struct LCaseMapping);
	void (*func)(void) = 0x0;

	if (argc <= 1)
	{
		printf("Enter a test case as an argument.\n\n");
		return 0;
	}
	while (i < numMappings)
	{
		if (strcmp(argv[1], Mapping[i].String) == 0)
			func = Mapping[i].Function;
		i=i+1;
	}
	if (func != 0x0)
		func();
}

// Test Cases Follow:

/*!
  Print the array of mappings.
  This function should be in every tester
*/
void Help(void)
{
	int i=0;
	int numMappings = sizeof(Mapping)/sizeof(struct LCaseMapping);
	printf("Mappings:\n");
	while (i < numMappings)
	{
		printf("  >%s\n", Mapping[i].String);
		i=i+1;
	}
}
